#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# @Author  : tester
# @Site    : DONGFANG_HOTEL-10F
# @Software: PyCharm
# @datetime:2020/11/3 17:21
# @license: (C) Copyright 2018-2027, By 金锡科技.
"""

from selenium import webdriver
from selenium.webdriver.chrome.options import Options


class WebDriver(object):
    chromedriver_path = 'F:\\PycharmProjects\\webdriver\\chromedriver'
    firefoxdriver_path = 'F:\\PycharmProjects\\webdriver\\geckodriver'
    edgedriver_path = 'F:\\PycharmProjects\\webdriver\\msedgedriver'
    operadriver_path = 'F:\\PycharmProjects\\webdriver\\operadriver'

    # chrome browser,无界面模式
    def NoBrowserChromeDriver(self):
        chrome_options = Options()
        chrome_options.add_argument('--headless')
        chrome_options.add_argument('--disable-gpu')
        driverChrome = webdriver.Chrome(executable_path=self.chromedriver_path, chrome_options=chrome_options)
        return driverChrome

    # chrome browser,有界面模式
    def BrowserChromeDriver(self):
        driverChrome = webdriver.Chrome(executable_path=self.chromedriver_path)
        return driverChrome

    # firefox browser,有界面模式
    def BrowserFirefoxDriver(self):
        driverFirefox = webdriver.Firefox(executable_path=self.firefoxdriver_path)
        return driverFirefox

    # edge browser,有界面模式
    def BrowserEdgeDriver(self):
        driverEdge = webdriver.Edge(executable_path=self.edgedriver_path)
        return driverEdge

    # opera browser,有界面模式
    def BrowserOperaDriver(self):
        driverOpera = webdriver.Edge(executable_path=self.operadriver_path)
        return driverOpera
